<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>DrawSurface.as</title>
<link rel="stylesheet" type="text/css" href="../../../../../SourceStyles.css"/>
</head>

<body><pre><span class="ActionScriptpackage">package</span> <span class="ActionScriptDefault_Text">com</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">sap</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">coe</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">surface</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">sap</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">coe</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">surface</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">events</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">TraceEvent</span>;    
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">events</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">MouseEvent</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">geom</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Point</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">core</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">IVisualElement</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">spark</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">components</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Group</span>;
    
    <span class="ActionScriptASDoc">/** Event dispatched when a new trace is started. */</span>
    <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Event</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptString">"traceStart"</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">type</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">"com.sap.coe.surface.events.TraceEvent"</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">]</span>
    
    <span class="ActionScriptASDoc">/** Event dispatched when a trace has ended. */</span>
    <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Event</span><span class="ActionScriptBracket/Brace">(</span> <span class="ActionScriptString">"traceEnd"</span><span class="ActionScriptOperator">,</span>     <span class="ActionScriptDefault_Text">type</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">"com.sap.coe.surface.events.TraceEvent"</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">]</span>
    
    <span class="ActionScriptASDoc">/**
     * Surface to draw traces. Currently registered to mouse events. Touch events to be added.
     * 
     * @author D045743
     */</span>
    <span class="ActionScriptReserved">public</span> <span class="ActionScriptclass">class</span> <span class="ActionScriptDefault_Text">DrawSurface</span> <span class="ActionScriptReserved">extends</span> <span class="ActionScriptDefault_Text">Group</span>
    <span class="ActionScriptBracket/Brace">{</span>
        <span class="ActionScriptComment">//=================================
</span>        <span class="ActionScriptComment">//===         PUBLIC VARIABLES    ===
</span>        <span class="ActionScriptComment">//=================================
</span>        <span class="ActionScriptASDoc">/** Set whether fading should be activated. False by default. */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">useFading</span> : <span class="ActionScriptDefault_Text">Boolean</span>;
        
        <span class="ActionScriptASDoc">/** Duration of circle fading effect */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">fadeDuration</span> : <span class="ActionScriptDefault_Text">Number</span>;
        
        <span class="ActionScriptComment">//=================================
</span>        <span class="ActionScriptComment">//===         PRIVATE VARIABLES    ===
</span>        <span class="ActionScriptComment">//=================================
</span>        <span class="ActionScriptASDoc">/** Indicates whether the user is currently drawing on the surface */</span>
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">drawing</span> : <span class="ActionScriptDefault_Text">Boolean</span>;
                
        <span class="ActionScriptASDoc">/** A vector of currently visible/drawn circles */</span>
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">circles</span> : <span class="ActionScriptDefault_Text">Vector</span><span class="ActionScriptBracket/Brace">.&lt;</span><span class="ActionScriptDefault_Text">TraceCircle</span><span class="ActionScriptBracket/Brace">&gt;</span>;
        
        <span class="ActionScriptComment">//=================================
</span>        <span class="ActionScriptComment">//===         CONSTRUCTOR            ===
</span>        <span class="ActionScriptComment">//=================================
</span>        <span class="ActionScriptASDoc">/** Creates a new instance of DrawSurface. */</span>
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">DrawSurface</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">super</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptComment">// register required mouse down
</span>            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">MOUSE_DOWN</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">mouseDownHandler</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">MOUSE_UP</span><span class="ActionScriptOperator">,</span>   <span class="ActionScriptDefault_Text">mouseUpHandler</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptComment">//=================================
</span>        <span class="ActionScriptComment">//===         EVENT HANDLERS        ===
</span>        <span class="ActionScriptComment">//=================================
</span>        <span class="ActionScriptASDoc">/** Mouse down event handler: Activates drawing process. */</span>
        <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">mouseDownHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span> : <span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>            
            <span class="ActionScriptComment">// start drawing -&gt; register mouse move and mouse up
</span>            <span class="ActionScriptDefault_Text">startDrawing</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptComment">// create new circle buffer
</span>            <span class="ActionScriptDefault_Text">circles</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Vector</span><span class="ActionScriptBracket/Brace">.&lt;</span><span class="ActionScriptDefault_Text">TraceCircle</span><span class="ActionScriptBracket/Brace">&gt;</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptComment">// dispatch trace start event
</span>            <span class="ActionScriptDefault_Text">dispatchEvent</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">TRACE_START</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptASDoc">/** Mouse Up event handler: Terminates drawing process. */</span>
        <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">mouseUpHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span> : <span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptComment">// stop draw mode, remove listeners
</span>            <span class="ActionScriptDefault_Text">stopDrawing</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptComment">// remove circles from display
</span>            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">removeAllElements</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptComment">// create trace element
</span>            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">currentTrace</span> : <span class="ActionScriptDefault_Text">Trace</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Trace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptReserved">for each</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">circle</span> : <span class="ActionScriptDefault_Text">TraceCircle</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">circles</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// remove effect event listeners
</span>                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">useFading</span><span class="ActionScriptBracket/Brace">)</span> 
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">removeEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">TRACE_FADE_OUT</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">circleFadeOutHandler</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">stopFadeEffect</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptBracket/Brace">}</span>
                
                <span class="ActionScriptComment">// add to trace
</span>                <span class="ActionScriptDefault_Text">currentTrace</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addPoint</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Point</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">width</span> <span class="ActionScriptOperator">/</span> 2<span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">height</span> <span class="ActionScriptOperator">/</span> 2<span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptComment">// dispose for garbage collection
</span>            <span class="ActionScriptDefault_Text">circles</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">null</span>;
            
            <span class="ActionScriptComment">// dispatch trace end event
</span>            <span class="ActionScriptDefault_Text">dispatchEvent</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">TRACE_END</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">currentTrace</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptASDoc">/** Mouse move event handler: Captures drawn points for trace. */</span>
        <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">mouseMoveHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span> : <span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>            
            <span class="ActionScriptComment">// create and add circle
</span>            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">circle</span> : <span class="ActionScriptDefault_Text">TraceCircle</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">TraceCircle</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">x</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">localX</span> <span class="ActionScriptOperator">-</span> <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">width</span> <span class="ActionScriptOperator">/</span> 2;
            <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">y</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">localY</span> <span class="ActionScriptOperator">-</span> <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">height</span> <span class="ActionScriptOperator">/</span> 2;
            
            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addElement</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptBracket/Brace">)</span>; <span class="ActionScriptComment">// visual element
</span>            <span class="ActionScriptDefault_Text">circles</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptBracket/Brace">)</span>;     <span class="ActionScriptComment">// for trace
</span>            
            <span class="ActionScriptComment">// start fading effect if required
</span>            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">useFading</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// add fade out handler
</span>                <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">TRACE_FADE_OUT</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">circleFadeOutHandler</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptReserved">false</span><span class="ActionScriptOperator">,</span> 0<span class="ActionScriptOperator">,</span> <span class="ActionScriptReserved">true</span><span class="ActionScriptBracket/Brace">)</span>;
                
                <span class="ActionScriptComment">// start effect
</span>                <span class="ActionScriptDefault_Text">circle</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">startFadeEffect</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">fadeDuration</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptASDoc">/** Circle fade event handler: Removes a circle from the trace. */</span>
        <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">circleFadeOutHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span> : <span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptComment">// remove circle from display list
</span>            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">removeElement</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">target</span> <span class="ActionScriptReserved">as</span> <span class="ActionScriptDefault_Text">IVisualElement</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptComment">// remove last added element from trace circles
</span>            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">idx</span> : <span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">circles</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">indexOf</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">target</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">idx</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptDefault_Text">circles</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">splice</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">idx</span><span class="ActionScriptOperator">,</span> 1<span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptASDoc">/** Register mouse events for drawing. */</span>
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">startDrawing</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">MOUSE_MOVE</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">mouseMoveHandler</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">MOUSE_UP</span><span class="ActionScriptOperator">,</span>   <span class="ActionScriptDefault_Text">mouseUpHandler</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptASDoc">/** Deregister mouse events to stop drawing. */</span>
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">stopDrawing</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">removeEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">MOUSE_MOVE</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">mouseMoveHandler</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">this</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">removeEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">MouseEvent</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">MOUSE_UP</span><span class="ActionScriptOperator">,</span>   <span class="ActionScriptDefault_Text">mouseUpHandler</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptBracket/Brace">}</span>
<span class="ActionScriptBracket/Brace">}</span></pre></body>
</html>
